var editor;
function pageInit(str)
{
	var plugins={
		Code:{c:'btnCode',t:'插入代码',h:1,e:function(){
			var _this=this;
			var htmlCode='<div><select id="xheCodeType"><option value="C/C++">C/C++</option></select></div><div><textarea id="xheCodeValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
			var jCode=$(htmlCode),jType=$('#xheCodeType',jCode),jValue=$('#xheCodeValue',jCode),jSave=$('#xheSave',jCode);
			jSave.click(function(){
				_this.loadBookmark();
				//_this.pasteText("<div style='margin:0px 0px 0px 0px'><span style='color:#666666'>"+_this.domEncode(jValue.val())+" code</span>:<pre id='code' style='border: solid 1px #bbbbbb; padding:10px 5px 10px 20px'>"+jValue.val()+"</pre></div>");
				_this.pasteHTML('[code='+jType.val()+']<br />'+codeToHtml(jValue.val())+'<br />[/code]');
				_this.hidePanel();
				return false;	
			});
			_this.saveBookmark();
			_this.showDialog(jCode);
		}}
	};
	var tools = 'Bold,Italic,Underline,Strikethrough,Fontface,FontSize,FontColor,BackColor,';
		tools +='Blocktag,Align,Cut,Copy,Paste,Pastetext,Removeformat,List,Link,Unlink,Img,';
		tools += 'Code,Hr,Emot,Table,Source,Preview,Print,Fullscreen,About';

	width = $('#content').width() * 0.9;
	editor = $('#editor').xheditor({tools:tools, plugins:plugins, width:width, height: 480, beforeSetSource:ubb2html,beforeGetSource:html2ubb});
	editor.setSource(str);
}
